//
// Created by wenyaxi on 24-11-4.
//

#include <vector>

#include <common.h>

#include "json.hpp"

class Solution {
public:
    deque<int> a_stk;
    deque<int> b_stk;
    deque<int> c_stk;

    nlohmann::json j;

    int hanoi(int n) {
        for (int i = n; i >=1; i--) {
            a_stk.push_back(i);
        }
        j["a"] = a_stk;
        j["b"] = b_stk;
        j["c"] = c_stk;
        cout << j.dump() << endl;
        move(n, a_stk, b_stk, c_stk);
    }

    void move(int n, deque<int> &a, deque<int> &b, deque<int> &c) {
        if (n == 0) {
            return;
        }
        move(n - 1, a, c, b);
        c.push_back(a.back());
        a.pop_back();
        j["a"] = a_stk;
        j["b"] = b_stk;
        j["c"] = c_stk;
        cout << j.dump() << endl;
        move(n - 1, b, a, c);
    }
};

int main(int argc, char *argv[]) {
    Solution s;
    s.hanoi(4);
    return 0;
}
